package com.hospital.xiaochengxiu.yan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hospital.xiaochengxiu.yan.dao.ConsumeinfoMapper;
import com.hospital.xiaochengxiu.yan.entity.Consumeinfo;
import com.hospital.xiaochengxiu.yan.service.ConsumeinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsumeinfoServiceImpl implements ConsumeinfoService {

    @Autowired
    private ConsumeinfoMapper consumeinfoMapper;
    /**
     * 根据卡号查询该用户的缴费信息记录
     * @param cardNo
     * @return
     */
    @Override
    public List<Consumeinfo> selectByCardNo(String cardNo) {
        QueryWrapper<Consumeinfo> queryWrapper=new QueryWrapper();
        queryWrapper.eq("cardNo",cardNo);
        queryWrapper.groupBy("times").orderByDesc("times");
        List<Consumeinfo> list = consumeinfoMapper.selectList(queryWrapper);
        return list;
    }
}
